
angular.module('starter.controllers', [])
 	.controller('AppController', function($scope, $rootScope, $state,$ionicModal, $ionicHistory, $ionicPopup, Page, ApiEndpoint,sessionStore,$ionicPlatform) {
 		
 	$rootScope.$on('userLoginIntercepted', function(event, data) {
 		$state.go("login",null,{reload:true});
 	});
 	
 	$scope.goHome = function(){
 		 $ionicHistory.clearHistory();
		 $state.go('home');
 	};
	
	 $scope.backGo = function (){
		 if($ionicHistory.backView()){
			 $ionicHistory.goBack();
		 }else{
			 $scope.goHome();
		 }
     };
     
});

